/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Merlion.SCM.entity;

import java.io.Serializable;
import java.util.Calendar;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Indra
 */
@Entity
public class InventoryMovementsRecordEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private Long itemId;
    private String itemName;
    private int qty;
    private String direction; // "OUTBOUND/INBOUND"
    private Long warehouseId;
    private String warehouseName;
    @Temporal(TemporalType.TIMESTAMP)
    private Date movementDate;

    public InventoryMovementsRecordEntity() {
    }

    public void createLog(Long itemId, String itemName, int qty, String direction, Long warehouseId, String warehouseName) {
        this.itemId = itemId;
        this.itemName = itemName;
        this.qty = qty;
        this.direction = direction;
        this.warehouseId = warehouseId;
        this.warehouseName = warehouseName;
        Calendar cal = Calendar.getInstance();
        this.movementDate = cal.getTime();
    }        
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Date getMovementDate() {
        return movementDate;
    }

    public void setMovementDate(Date movementDate) {
        this.movementDate = movementDate;
    }
    
    public String getDirection() {
        return direction;
    }

    public void setDirection(String direction) {
        this.direction = direction;
    }

    public Long getItemId() {
        return itemId;
    }

    public void setItemId(Long itemId) {
        this.itemId = itemId;
    }

    public String getItemName() {
        return itemName;
    }

    public void setItemName(String itemName) {
        this.itemName = itemName;
    }

    public int getQty() {
        return qty;
    }

    public void setQty(int qty) {
        this.qty = qty;
    }

    public Long getWarehouseId() {
        return warehouseId;
    }

    public void setWarehouseId(Long warehouseId) {
        this.warehouseId = warehouseId;
    }

    public String getWarehouseName() {
        return warehouseName;
    }

    public void setWarehouseName(String warehouseName) {
        this.warehouseName = warehouseName;
    }

    
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof InventoryMovementsRecordEntity)) {
            return false;
        }
        InventoryMovementsRecordEntity other = (InventoryMovementsRecordEntity) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Merlion.SCM.entity.InventoryMovementsRecordEntity[ id=" + id + " ]";
    }
    
}
